import Vue from 'vue'
import Router from 'vue-router'
import Resource from 'vue-resource'

import Home from '../components/Home'
import Login from '../components/Login'
import Register from '../components/Register'

Vue.use(Resource)
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login' // 重定向
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/dataChart',
      name: 'dataChart',
      component:() => import('../components/DateChart') 
      // 路由懒加载
    },
    {
      path: '/dataSon',
      name: 'dataSon',
      component:() => import('../components/DateSon') 
      // 路由懒加载
    }
  ]
})
